package com.yao.mybatis.sqlsource;

import com.yao.mybatis.sqlnode.MixedSqlNode;

/**
 * 该sqlSource主要是封装非动态的sqlNode信息 也就是不带${}或者动态sql标签的sqlNode
 * @author Administrator
 */
public class RawSqlSource  implements SqlSource {


    private SqlSource sqlSource;

    public RawSqlSource(MixedSqlNode mixedSqlNode) {
        DynamicContext dynamicContext = new DynamicContext(null);
        //对每个sqlNode进行解析
        mixedSqlNode.apply(dynamicContext);
        //对sqlSource进行解析
        SqlSourceParser sqlSourceParser = new SqlSourceParser();
        sqlSourceParser.parse(dynamicContext.getSql());
    }

    @Override
    public BoundSql getBoundSql(Object param) {
        return sqlSource.getBoundSql(param);
    }
}
